package com.example.springboot01.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springboot01.entity.TeacherClass;
import com.example.springboot01.mapper.TeacherClassMapper;
import com.example.springboot01.service.TeacherClassService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class TeacherClassServiceImpl extends ServiceImpl<TeacherClassMapper, TeacherClass> implements TeacherClassService {

    @Override
    public List<Integer> queryClassIdByTeacher(Integer teacherID) {
        List<TeacherClass> list = this.list(new LambdaQueryWrapper<TeacherClass>()
                .eq(TeacherClass::getTeacherId, teacherID)
        );
        return list.stream().map(TeacherClass::getClassId).collect(Collectors.toList());
    }
}
